package com.jiangyao.controller;


import com.github.pagehelper.PageInfo;
import com.jiangyao.common.ApiResult;
import com.jiangyao.common.exception.ServerException;
import com.jiangyao.model.dto.backend.AddJobDTO;
import com.jiangyao.model.dto.backend.EditStatusDTO;
import com.jiangyao.model.dto.backend.JobListDTO;
import com.jiangyao.model.entity.InterviewInvitation;
import com.jiangyao.model.vo.JobVo;
import com.jiangyao.service.InterviewInvitationService;
import com.jiangyao.service.JobService;
import com.jiangyao.service.ResumeSendService;
import com.jiangyao.service.ResumeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 招聘 前端控制器
 * </p>
 *
 * @author zhoushuangxiang
 * @since 2020-08-12
 */
@RestController
@RequestMapping("/recruit")
@Api(tags = "招聘相关接口")
public class RecruitController extends BaseController {

    @Autowired
    private InterviewInvitationService interviewInvitationService;

    @Autowired
    private ResumeSendService resumeSendService;

    @ApiOperation(value = "发送面试邀请")
    @PostMapping("/sendInvitation")
    public ApiResult sendInvitation(@RequestBody InterviewInvitation interviewInvitation){
        try {
            interviewInvitationService.sendInvitation(interviewInvitation);
            return ApiResult.success("发送面试邀请成功");
        } catch (ServerException e) {
            return ApiResult.error(e.getMessage());
        }
    }


    @ApiOperation(value = "修改投递简历状态")
    @PostMapping("/editStatus")
    public ApiResult editStatus(@RequestBody EditStatusDTO editStatusDTO){
        resumeSendService.editStatus(editStatusDTO);
        return ApiResult.success("修改投递的简历状态成功");
    }


}

